package com.shcz.migu.utils;

import android.text.TextUtils;

/**
 * Created by mac on 2017/8/8.
 */

public class StringUtils {
    public int counter = 0;
    //Str1 中包含 str2的个数
    public int countStr(String str1, String str2) {
        if (TextUtils.isEmpty(str1))
            return counter;
        if (str1.indexOf(str2) == -1) {
            return 0;
        } else if (str1.indexOf(str2) != -1) {
            counter++;
            countStr(str1.substring(str1.indexOf(str2) +
                    str2.length()), str2);
            return counter;
        }
        return 0;
    }
}
